import axios from "axios"
export default {
    namespaced: true,
    state: {
        yanyuan:[]
    },
    mutations: {
        getYanYuanData(state, yanyuanData) {
            for(let i = 0;i <yanyuanData.data[0].length; i++) {
                 state.yanyuan.push(yanyuanData.data[0][i])
            }
            for(let j = 0;j <yanyuanData.data[1].length; j++) {
                state.yanyuan.push(yanyuanData.data[1][j])
           }
        }

    },
    actions: {
        getYanYuanData({
            commit
        },data) {
            axios({
                method: "get",
                url: `/mmdb/v7/movie/${data}/celebrities.json`
            }).then((res) => {
                commit("getYanYuanData", res.data)
            })
        }
    }
}